export function claculate(data, id) {
  const student = data.filter((item) => item.student_id === id);
  const results = student.map((item) => item.sum_score);
  const student_name = data.find((item) => item.student_id === id).student_name as string;
  const sum = (total, num) => {
    return total + num;
  };
  // 计算出平均分
  const averageScore = parseFloat((results.reduce(sum, 0) / student.length).toFixed(2));
  const obj = {
    student_name,
    averageScore,
  };
  return obj;
}
